package com.ruoyi.monitors.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.monitors.mapper.MonDeviceMapper;
import com.ruoyi.monitors.domain.MonDevice;
import com.ruoyi.monitors.service.IMonDeviceService;
import com.ruoyi.common.core.text.Convert;

/**
 * 设备列表Service业务层处理
 * 
 * @author huqin
 * @date 2022-07-10
 */
@Service
public class MonDeviceServiceImpl implements IMonDeviceService 
{
    @Autowired
    private MonDeviceMapper monDeviceMapper;

    /**
     * 查询设备列表
     * 
     * @param deviceId 设备列表主键
     * @return 设备列表
     */
    @Override
    public MonDevice selectMonDeviceByDeviceId(Long deviceId)
    {
        return monDeviceMapper.selectMonDeviceByDeviceId(deviceId);
    }

    /**
     * 查询设备列表列表
     * 
     * @param monDevice 设备列表
     * @return 设备列表
     */
    @Override
    public List<MonDevice> selectMonDeviceList(MonDevice monDevice)
    {
        return monDeviceMapper.selectMonDeviceList(monDevice);
    }

    /**
     * 新增设备列表
     * 
     * @param monDevice 设备列表
     * @return 结果
     */
    @Override
    public int insertMonDevice(MonDevice monDevice)
    {
        monDevice.setCreateTime(DateUtils.getNowDate());
        return monDeviceMapper.insertMonDevice(monDevice);
    }

    /**
     * 修改设备列表
     * 
     * @param monDevice 设备列表
     * @return 结果
     */
    @Override
    public int updateMonDevice(MonDevice monDevice)
    {
        monDevice.setUpdateTime(DateUtils.getNowDate());
        return monDeviceMapper.updateMonDevice(monDevice);
    }

    /**
     * 批量删除设备列表
     * 
     * @param deviceIds 需要删除的设备列表主键
     * @return 结果
     */
    @Override
    public int deleteMonDeviceByDeviceIds(String deviceIds)
    {
        return monDeviceMapper.deleteMonDeviceByDeviceIds(Convert.toStrArray(deviceIds));
    }

    /**
     * 删除设备列表信息
     * 
     * @param deviceId 设备列表主键
     * @return 结果
     */
    @Override
    public int deleteMonDeviceByDeviceId(Long deviceId)
    {
        return monDeviceMapper.deleteMonDeviceByDeviceId(deviceId);
    }
}
